from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
import sys
from PyQt5.QtCore import QSize, Qt


class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        self.setWindowTitle('My App')

        self.button = QPushButton('Press Me !!!')
        self.button.clicked.connect(self.the_button_was_clicked)

        self.setMinimumSize(QSize(400, 300))
        self.setMaximumSize(QSize(600, 450))
        self.setCentralWidget(self.button)

    def the_button_was_clicked(self, *args):
        print('Clicked!', *args)
        self.button.setText('You have pressed me already !')
        self.button.setEnabled(False)
        self.setWindowTitle('My Oneshot App')


app = QApplication(sys.argv)

window = MainWindow()
window.show()

app.exec_()
